define(["echarts"],function() {


        var drawK=function(c){
             require(
                                [
                                    'echarts',
                                    'echarts/chart/k', // 使用柱状图就加载bar模块，按需加载
                                     'echarts/chart/line' // 使用柱状图就加载bar模块，按需加载
                                ],
                                function (ec) {
                                    // 基于准备好的dom，初始化echarts图表
                                    var myChart = ec.init(document.getElementById('level1'));

                                   var option = {
                                       title : {
                                           text: '2013年上半年上证指数'
                                       },
                                       tooltip : {
                                           trigger: 'axis',
                                           formatter: function (params) {
                                               var res = params[0].seriesName + ' ' + params[0].name;
                                               res += '<br/>  开盘 : ' + params[0].value[0] + '  最高 : ' + params[0].value[3];
                                               res += '<br/>  收盘 : ' + params[0].value[1] + '  最低 : ' + params[0].value[2];
                                               return res;
                                           }
                                       },
                                       legend: {
                                           data:['上证指数']
                                       },
                                       toolbox: {
                                           show : true,
                                           feature : {
                                               mark : {show: true},
                                               dataZoom : {show: true},
                                               dataView : {show: true, readOnly: false},
                                               magicType: {show: true, type: ['line', 'bar']},
                                               restore : {show: true},
                                               saveAsImage : {show: true}
                                           }
                                       },

                                       xAxis : [
                                           {
                                               type : 'category',
                                               boundaryGap : true,
                                               axisTick: {onGap:false},
                                               splitLine: {show:false},
                                               data : [
                                                   "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",               "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30"
                                    ,"2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",               "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30"


                                               ]
                                           }
                                       ],
                                       yAxis : [
                                           {
                                               type : 'value',
                                               scale:true,
                                               boundaryGap: [0.01, 0.01]
                                           }
                                       ],
                                       series : [
                                           {
                                               name:'上证指数',
                                               type:'k',
                                               data:[ // 开盘，收盘，最低，最高
                                                   [2320.26,2302.6,2287.3,2362.94],
                                                   [2300,2291.3,2288.26,2308.38],
                                                   [2295.35,2346.5,2295.35,2346.92],
                                                   [2347.22,2358.98,2337.35,2363.8],
                                                   [2360.75,2382.48,2347.89,2383.76],
                                                                 [2320.26,2302.6,2287.3,2362.94],
                                                   [2300,2291.3,2288.26,2308.38],
                                                   [2295.35,2346.5,2295.35,2346.92],
                                                   [2347.22,2358.98,2337.35,2363.8],
                                                   [2360.75,2382.48,2347.89,2383.76],
                                                                   [2320.26,2302.6,2287.3,2362.94],
                                                                   [2300,2291.3,2288.26,2308.38],
                                                                   [2295.35,2346.5,2295.35,2346.92],
                                                                   [2347.22,2358.98,2337.35,2363.8],
                                                                   [2360.75,2382.48,2347.89,2383.76],
                                                                                 [2320.26,2302.6,2287.3,2362.94],
                                                                   [2300,2291.3,2288.26,2308.38],
                                                                   [2295.35,2346.5,2295.35,2346.92],
                                                                   [2347.22,2358.98,2337.35,2363.8],
                                                                   [2360.75,2382.48,2347.89,2383.76]
                                               ]
                                           },
                                         {
                                               name:'上证指数',
                                               type:'line',
                                               data:[ // 开盘，收盘，最低，最高
                                                   2300,2300,2280,2200,2400,2300,2300,2280,2200,2400,2300,2300,2280,2200,2400,2300,2300,2280,2200,2400
                                               ]
                                           }
                                       ]
                                   };

                                    // 为echarts对象加载数据
                                    myChart.setOption(option);
                                }
                            );
         };
         var tt="i am xiaot";
         return {drawK:drawK,val:tt};

    }
);